{include file="admin@public/header"/}
<script type="text/javascript">
var DOMAIN = document.domain;
var WDURL = "";
var SCHEME= "blue";
try{
  var host = window.location.host;
    var domainDot = host.indexOf('.');
    var domain = host.substring(domainDot + 1,host.length);
    document.domain = domain;
}catch(e){
}
//ctrl+F5 增加版本号来清空iframe的缓存的
$(document).keydown(function(event) {
  /* Act on the event */
  if(event.keyCode === 116 && event.ctrlKey){
    var defaultPage = Public.getDefaultPage();
    var href = defaultPage.location.href.split('?')[0] + '?';
    var params = Public.urlParam();
    params['version'] = Date.parse((new Date()));
    for(i in params){
      if(i && typeof i != 'function'){
        href += i + '=' + params[i] + '&';
      }
    }
    defaultPage.location.href = href;
    event.preventDefault();
  }
});
</script>
<style>

.system-parameter-wrapper{
    background-color: white;
    overflow: auto;
    padding: 0px !important;
    padding-bottom: -11px;
    position: absolute;
    top: 11px;
    left: 11px;
    right: 11px;
    bottom: 11px;
}

.para-wrapper{font-size:14px; }
.para-wrapper .para-item h3{font-size:14px;font-weight:bold;margin-bottom:10px;}

.mod-form-rows .label-wrap { width:260px; }
#content3 .mod-form-rows .label-wrap { width:100px; }
#content3 .mod-form-rows td{
  border:1px solid #DDD;
  padding: 5px 10px;
}

.base { width:160px !important; }
.para-item .ui-input{width:220px;font-size:14px;}

.subject-para .ui-input{width:40px;}

.code-length .ui-spinbox-wrap{margin-right:0;}

.books-para input{margin-top:-3px;}

#currency{width: 68px;}
.ui-droplist-wrap .list-item {font-size:14px;}

.tablabel {
    font-weight: bold;
    color: #8e8e8e;
    font-size: 16px;
    display: block;
    padding: 0.5px 30px 10px 30px;
    width: 100px;
}
#three .price-label {
  width: 150px;

}
label:hover {
  cursor: pointer;
}
section {
  display: none;
}
#tab1:checked ~ #content1, #tab2:checked ~ #content2, #tab3:checked ~ #content3 {
  display: block;
}
input:checked + div label {
    color: #48bfea;
    border-bottom: 2px solid #48bfea;
}
.hl{
    width: 90%;
    margin-top: 12px;
    margin-left: 26px;
    height: 2px;
    background-color: #DDD;
}

#one.clicked{
  margin-left: 26px;
  background-position: -25px 0px;
}

#one{
  margin-left: 26px;
  background-position: 0px 0px;
}

#two.normal{
  margin-left: 130px;
  background-position: -50px 0px;
}
#two.clicked{
  margin-left: 130px;
  background-position: -75px 0px;
}

#three.normal{
  margin-left: 150px;
  background-position: -100px 0px;
}
#three.clicked{
  margin-left: 150px;
  background-position: -125px 0px;
}
.operateBtn {
  margin: 0 10px 0 10px;
}
.operateBtn:hover {
  color: #48bfea;
  margin: 0 10px 0 10px;
  border-bottom: 1px solid #48bfea;
  cursor: pointer;
}
.tx-center {
  text-align: center;
}

.backgroundTabs{
    background: url(/css/img/blueandwhite.png) no-repeat;
    background-position: -25px 0px;
    width: 25px;
    height: 22px;
    display: inline-block;
    margin-top: 34px;
}

.mod-form-rows td{
  border:1px solid #DDD;
  padding: 5px 20px;
}

.mod-form-rows{
  border-collapse:collapse;
}

.td1{
  width: 200px;
}

.td2{
    width: 220px;
    text-align: center;
    padding: 5px 10px !important;
}

.td3{
  width: 1000px;
}

#content3 .td1{
  width: 60px;
}

#content3 .td2{
    width: 100px;
    text-align: center;
    padding: 5px 10px !important;
}

#content3 .td3{
  width: 540px;
}

#content1, #content2, #content3{
  margin-top: 22px;
  margin-left: 26px;
}

.tdtitle{
  text-align: center;
}
.table-tips {
  margin-bottom: 20px;
  color: #48bfea;
  font-size: 16px;
}
.system-parameter-wrapper .ui-btn{
    margin-top: 40px;
    margin-left: 26px;
    margin-bottom: 15px;
    background-color: #ff8a00 !important;
    border: 1px solid #ec8000;
}
.chk_blue input {
    display: inline-block;
    position: absolute;
    width: 16px;
    height: 16px;
    cursor: pointer;
    left: 0;
    top: 1px;
    opacity: 0;
}
.chk_blue {
    position: relative;
    font-size: 12px;
    background-position-y: center;
}
.chk_blue label {
  padding-left: 5px;
}
/* new.gif图标 */
.newMenuIcon{display: inline-block;width: 30px;height: 16px;background: url(/css/img/new.gif);}
td.ui_icon {vertical-align: middle;}
.ui_icon img.ui_icon_bg {width: auto;height: auto;}

.forbidden-date-desc {
  color: #999;
  margin-top: -8px;
}

#scmWeb,
#scmApp {
  margin-right: 5px;
}
.price-higher-title {font: bold 20px '微软雅黑';}
</style>
<div class="wrapper system-parameter-wrapper">

<input id="tab1" type="radio" name="tabs" class="tabs" checked hidden>
<div id="one" class="clicked backgroundTabs"><label class="tablabel" for="tab1">基础参数</label></div>
<input id="tab2" type="radio" name="tabs" class="tabs" hidden>
<div id="two" class="normal backgroundTabs"><label class="tablabel"id="cs" name="cs"  for="tab2" >功能参数</label></div>
<input id="tab3" type="radio" name="tabs" class="tabs" hidden>
<div id="three" class="normal backgroundTabs"><label class="tablabel price-label" for="tab3">价格取数优先级<span class="newMenuIcon"></span></label></div>

<div class="hl"></div>

<section id="content1">

<div class="para-item" id="sx">

  <ul class="mod-form-rows" id="establish-form">
     {volist name="list" id="vo"}
    <li class="row-item">
      <div class="label-wrap base">
        <label for="companyName">公司名称：</label>
      </div>
      <div class="ctn-wrap">
        <input type="text" name="companyName" class="ui-input" value="{$vo.company_name}" id="companyName" />
          <span id="companyName"></span>
      </div>
    </li>
    <li class="row-item">
      <div class="label-wrap base">
        <label for="companyAddress">公司地址：</label>
      </div>
      <div class="ctn-wrap">
        <input type="text" name="companyAddress" class="ui-input" id="companyAddress" />
      </div>
    </li>
    <li class="row-item">
      <div class="label-wrap base">
        <label for="companyTel">公司电话：</label>
      </div>
      <div class="ctn-wrap">
        <input type="text" name="companyTel" class="ui-input" id="companyTel" />
      </div>
    </li>
    <li class="row-item">
      <div class="label-wrap base">
        <label for="companyFax">公司传真：</label>
      </div>
      <div class="ctn-wrap">
        <input type="text" name="companyFax" class="ui-input" id="companyFax" />
      </div>
    </li>
    <li class="row-item">
      <div class="label-wrap base">
        <label for="postcode" >公司邮编：</label>
      </div>
      <div class="ctn-wrap">
        <input type="text" name="postcode" class="ui-input" id="postcode" />
      </div>
    </li>
    <li class="row-item">
      <div class="label-wrap base">
        <label for="startDate">启用时间：</label>
      </div>
      <div class="ctn-wrap">
        <input type="text" name="startDate" value="{:date('Y-m-d',$vo['company_time'])}" class="ui-input ui-input-dis" id="startDate" disabled="disabled" />
      </div>
    </li>
    <li class="row-item">
      <div class="label-wrap base">
        <label for="currency">本位币：</label>
      </div>
      <div class="ctn-wrap">
        <input type="text" class="ui-input ui-input-dis" id="currency" value="{$vo.company_base}" disabled="disabled"/>
        <!--<select id="currency-sel" name="currency-sel">
          <option value="RMB">RMB</option>
        </select>--> 
      </div>
    </li>
    <li class="row-item">
      <div class="label-wrap base">
        <label>数量小数位：</label>
      </div>
      <div class="ctn-wrap">
        <input type="number" style="width: 69px;" name="qtyPlaces" value="{$vo.company_quantity}" id="qtyPlaces" class="ui-input" />
        <label style="color: red">小数位由小改大后将不能再改小,请慎重!</label>
      </div>

    </li>
    <li class="row-item">
      <div class="label-wrap base">
        <label>单价小数位：</label>
      </div>
      <div class="ctn-wrap">
        <input type="number"  style="width: 69px;" name="pricePlaces" id="pricePlaces" value="{$vo.company_up}" class="ui-input" />
        <label style="color: red">小数位由小改大后将不能再改小,请慎重!</label>
      </div>
    </li>

    <li class="row-item">
      <div class="label-wrap base">
        <label for="valMethods">存货计价方法：</label>
      </div>
      <div class="ctn-wrap" id="select">
        <select class="ui-input"name="valMethods" id="valMethods" style="height: 30px;width: 233px;">
          <option name="valMethods"  value ="1">先进平移算法</option>
          <option name="valMethods"  value ="2">移动平均算法</option>
        </select>
      </div>
    </li>
    <li class="row-item">
      <div class="label-wrap base">
        <label for="requiredCheckStore">是否检查负库存：</label>
      </div>
      <div class="ctn-wrap">
        {if  condition="$vo['company_inspect']==1" }
        <input type="checkbox"  id="requiredCheckStore" checked="true">
        {else /}
        <input type="checkbox"  id="requiredCheckStore" >
        {/if}
      </div>
    </li>
    <input type="hidden" name="hidden1" id="hidden1" value="1">
  </ul>
  <div class="btn-wrap"> <input class="ui-btn ui-btn-sp" type="submit" name="" onclick="preservation()"> </div>

    {/volist}
  </div>
  <!--        <li class="row-item">
      <div class="label-wrap">
        <label>金额小数位：</label>
      </div>
      <div class="ctn-wrap">
        <input type="text" name="amountPlaces" id="amountPlaces" class="ui-input" />
      </div>
    </li>-->
  </section> 
  <section id="content2" class="section2">
    <div id="para-wrapper" class="para-wrapper">

      <div class="para-item">
        <div  class="para-item">
        <table class="mod-form-rows" id="establish-form2">
          <tr>
            <td class="td1">
              <div class="label-wrap tdtitle">
                <label>功能</label>
              </div>
            </td>
            <td class="td2 tdtitle">
              <div>
                <label>操作</label>
              </div>
            </td>
            <td class="td3 tdtitle">
              <div>
                <label>说明</label>
              </div>
            </td>
          </tr>
          {include file="settings/fun" /}
        </table>
          </div>
          <div class="btn-wrap"> <input class="ui-btn ui-btn-sp" type="submit" name="" onclick="save()"> </div>
        </div>
      </div>
  </section> 
  <section id="content3">
    <div id="price-wrapper" class="price-wrapper">
  <div class="para-item">
    {include file="settings/pap"/}
  </div>
  <div class="btn-wrap"> <input class="ui-btn ui-btn-sp" type="submit" name="" onclick="pap()"> </div>
  </div>
  <input type="hidden" name="hidden3" id="hidden3" value="3">
  
  </section>
</div>
<script type="text/javascript">
  // +----------------------------
 // +       价格取数优先级开始
 // +---------------------------
  function pap(){
    var pap_sgoods=$("#pap_sgoods");//获取销售价商品价格策略整个对象
    var pap_spriec=$("#pap_spriec");//获取销售价最近价格整个对象
    var pap_pgoods=$("#pap_pgoods");//获取采购价商品价格策略整个对象
    var pap_ppriec=$("#pap_ppriec");//获取采购价最近价格整个对象
    var hidden3=$("#hidden3").val();
    if (pap_sgoods.prop('checked')) {
      pap_sgoods=0;
    }else{
      pap_sgoods=1;
    }//销售价商品价格策略判断属性
    if (pap_spriec.prop('checked')) {
      pap_spriec=0;
    }else{
      pap_spriec=1;
    }//销售价最近价格判断属性
    if (pap_pgoods.prop('checked')) {
      pap_pgoods=0;
    }else{
      pap_pgoods=1;
    }//采购价商品价格策略判断属性
    if (pap_ppriec.prop('checked')) {
      pap_ppriec=0;
    }else{
      pap_ppriec=1;
    }//采购价最近价格判断属性
    $.ajax({
      type:"post",
      url:"index",
      datatype:"json",
      data:{
        pap_ppriec:pap_ppriec,
        pap_pgoods:pap_pgoods,
        pap_sgoods:pap_sgoods,
        pap_spriec:pap_spriec,
        hidden3:hidden3,        //传入判断那个方法的值
      },
      success:function(data){
        if (data.code==1) {
          layer.msg('更新成功',{icon:1,time:1000});
        }else{
          layer.msg('更新成功',{icon:1,time:1000});
        }
      },
      error:function(data){
        alert('请求失败');
      }
    })
  }
    // +----------------------------
    // +       价格取数优先级结束
    // +---------------------------

    // +----------------------------
    // +       功能系统开始
    // +---------------------------
   function save(){
    var hidden2=$("#hidden2").val();//判断是哪个方法
    var fun_examine=$("#fun_examine");//启用审核
    var fun_taxes=$("#fun_taxes");//启用税金
    var fun_ti=$("#fun_ti");//商品价格是否含税
    var fun_auxiliary=$("#fun_auxiliary");//启用辅助属性
    var fun_wisdom=$("#fun_wisdom");//启用智慧微店：
    var fun_sn=$("#fun_sn");//启用序列号：
    var fun_qgp=$("#fun_qgp");//启用批次保质期管理
    var fun_sa=$("#fun_sa");//启用自动填充结算金额：
    var fun_wa=$("#fun_wa");//启用分仓核算：
    var fun_esup=$("#fun_esup");//启用销售单价为0时提示：
    var fun_Dmina1=$("#fun_Dmina1");//启用销售类单据不允许修改单据日期
    var fun_Dmina2=$("#fun_Dmina2");//启用销售类单据不允许修改单据日期
    var fun_aad=$("#fun_aad");//开票金额取优惠后金额：
    var fun_ln=$("#fun_ln");//启用商品编号名称规格型号连续搜索：
    var fun_nc=$("#fun_nc");//启用后在单据的商品录入栏输入内容时会按照商品编号+商品名称+规格型号连续模糊搜索
    var fun_sc=$("#fun_sc");//启用销货类单据新增销售人员默认取上一张单据的值
    var tax_rate=$("#tax_rate").val();//税率的值
    var cd='';
          // +-----------------------
          // +判断 属性切赋值
          //+-----------------------
    if (fun_examine.prop('checked')) {
      fun_examine=0;
    }else{
      fun_examine=1;
    }//启用审核
    if (fun_taxes.prop('checked')) {
      fun_taxes=0;
    }else{
      fun_taxes=1;
    }//启用税金
     if (fun_ti.prop('checked')) {
      fun_ti=0;
    }else{
      fun_ti=1;
    }//商品价格是否含税
     if (fun_auxiliary.prop('checked')) {
      fun_auxiliary=0;
    }else{
      fun_auxiliary=1;
    }//启用辅助属性
     if (fun_wisdom.prop('checked')) {
      fun_wisdom=0;
    }else{
      fun_wisdom=1;
    }//启用智慧微店
     if (fun_sn.prop('checked')) {
      fun_sn=0;
    }else{
      fun_sn=1;
    }//启用序列号
     if (fun_qgp.prop('checked')) {
      fun_qgp=0;
    }else{
      fun_qgp=1;
    }//启用自动填充结算金额：
     if (fun_sa.prop('checked')) {
      fun_sa=0;
    }else{
      fun_sa=1;
    }//启用分仓核算：
     if (fun_wa.prop('checked')) {
      fun_wa=0;
    }else{
      fun_wa=1;
    }//启用销售单价为0时提示：
     if (fun_esup.prop('checked')) {
      fun_esup=0;
    }else{
      fun_esup=1;
    }//开票金额取优惠后金额：
     if (fun_aad.prop('checked')) {
      fun_aad=0;
    }else{
      fun_aad=1;
    }//启用商品编号名称规格型号连续搜索：
     if (fun_ln.prop('checked')) {
      fun_ln=0;
    }else{
      fun_ln=1;
    }//启用单据新增客户/供应商取上一次的值 (购货类单据、销货类单据)
     if (fun_nc.prop('checked')) {
      fun_nc=0;
    }else{
      fun_nc=1;
    }//启用销货类单据新增销售人员默认取上一张单据的值：
     if (fun_sc.prop('checked')) {
      fun_sc=0;
    }else{
      fun_sc=1;
    }
          // +-----------------------
          // +判断 选中移动还是网页
          // +-----------------------
    //判断 网页版 获取的值 1 是选中 2是没选中
    if (fun_Dmina2.prop('checked')) {
      fun_Dmina2=1;
    }else{
      fun_Dmina2=2;
    } 
    //判断 移动端 获取的值 1 是选中 2是没选中
     if (fun_Dmina1.prop('checked')) {
      fun_Dmina1=1;
    }else{
      fun_Dmina1=2;
    } 
    if (fun_Dmina1==1 && fun_Dmina2==1) {
      cd=1;
    }
    if (fun_Dmina1==2 && fun_Dmina2==2) {
      cd=2;
    }
    if (fun_Dmina1==1 && fun_Dmina2==2) {
      cd=3;
    }
    if (fun_Dmina1==2 && fun_Dmina2==1) {
      cd=4;
    }
     //cd=1时 网页版 和 移动端都选中 cd=2时 网页版 和移动端都没选中 cd=3 网页版选中 端游版未选 cd=4 移动端选 网页版未选择
    $.ajax({
      type:"post",
      url:"index",
      datatype:"json",
      data:{
        cd:cd,            //移动端网页端的值
        fun_examine:fun_examine,//启用审核
        hidden2:hidden2,
        fun_taxes:fun_taxes,//启用税金
        fun_ti:fun_ti,//商品价格是否含税
        fun_auxiliary:fun_auxiliary,//启用辅助属性
        fun_wisdom:fun_wisdom,//启用智慧微店
        fun_sn:fun_sn,//启用序列号
        fun_qgp:fun_qgp,//启用批次保质期管理
        fun_sa:fun_sa,//启用自动填充结算金额
        fun_wa:fun_wa,//启用分仓核算
        fun_esup:fun_esup,//启用销售单价为0时提示
        fun_aad:fun_aad,//开票金额取优惠后金额
        fun_ln:fun_ln,//启用商品编号名称规格型号连续搜索
        fun_nc:fun_nc,//启用单据新增客户/供应商取上一次的值
        fun_sc:fun_sc,//启用销货类单据新增销售人员默认取上一张单据的值
        tax_rate:tax_rate,//税率的值
      },
      success:function(data){
        if (data.code==1) {
          layer.msg(data.msg,{icon:1,time:1000});
        }else{
          layer.msg(data.msg,{icon:2,time:1000});
        }
      },
      error:function(da){
        alert('请求失败');  
      },
    })
  }
    // +----------------------------
    // +       功能系统结束
    // +---------------------------

    // +----------------------------
    // +       基础系统开始
    // +---------------------------
  function preservation(){
  	var companyName=$("#companyName").val();
  	var companyAddress=$("#companyAddress").val();
  	var companyTel=$("#companyTel").val();
  	var companyFax=$("#companyFax").val();
  	var postcode=$("#postcode").val();
  	var startDate=$("#startDate").val();
  	var currency=$("#currency").val();
  	var qtyPlaces=$("#qtyPlaces").val();
  	var pricePlaces=$("#pricePlaces").val();
  	var valMethods=$("#valMethods").val();
    var hidden1=$("#hidden1").val();
  	var requiredCheckStore=$("#requiredCheckStore");
    
    if (requiredCheckStore.prop('checked')) {
        requiredCheckStore=1;
    }else{
        requiredCheckStore=2;
    }   //判断是否选中 1是查看仓库2是不查看仓库
  	$.ajax({
  		type:"post",
  		url:"index",
  		datatype:"json",
  		data:{
  			companyName:companyName,
  			companyAddress:companyAddress,
  			companyTel:companyTel,
  			companyFax:companyFax,
  			postcode:postcode,
  			startDate:startDate,
  			currency:currency,
  			qtyPlaces:qtyPlaces,
  			pricePlaces:pricePlaces,
  			valMethods:valMethods,
  			requiredCheckStore:requiredCheckStore,
        hidden1:hidden1,
  		},
  		success:function(data){
        //验证返回1
  			if (data.code == 1) {
  				layer.msg(data.msg,{icon:2,time:1000});
  			}
        //保存成功返回2
        if (data.code == 2){ 
          layer.msg(data.msg,{icon:1,time:1000});
          history.go(0);
        }
  		},
  		error:function(data){
  		console.log(data.msg);
  		}
  	}) ;  
} ;
  // +----------------------------
    // +       基础系统结束
    // +---------------------------
</script>
{include file="admin@public/footer"/}